"""
烤地瓜类
 三个属性：时间 状态，调料
 两个方法： 被烤，添加调料
"""
class SweetPotato():
    # 初始化
    def __init__(self):
        # 被烤的时间
        self.cook_time = 0
        self.cook_state = '生的'
        # 调味料
        self.condiments = []

    # 烤地瓜的方法
    def cook(self,time):
        self.cook_time += time
        if 0 <=self.cook_time <3:
            self.cook_state = "生的"
        elif 3 <=self.cook_time <5:
            self.cook_state = "半生不熟"
        elif 5 <=self.cook_time <8:
            self.cook_state = "熟啦"
        elif 8 <= self.cook_time :
            self.cook_state = "烤糊了"

    # 添加调料
    def add_condiments(self,condiment):
        self.condiments.append(condiment)

    # 输出对象状态
    def __str__(self):
        return f'地瓜烤了【{self.cook_time}】分钟，状态是【{self.cook_state}】，' \
               f'添加的调料有【{self.condiments}】'

print("*"*20+'  开始烤地瓜  '+'*'*20)
sweetPotato = SweetPotato()
sweetPotato.cook(3)
print(sweetPotato)

sweetPotato2 = SweetPotato()
sweetPotato2.cook(10)
sweetPotato2.add_condiments("蜂蜜")
sweetPotato2.add_condiments("淡奶油")
print(sweetPotato2)

sweetPotato3 = SweetPotato()
sweetPotato3.cook(7)
sweetPotato3.add_condiments("芝士")
print(sweetPotato3)

